<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h:form id="conForm" enctype="multipart/form-data">
                <h1 class="title">
                    <a href="#" class="back" onclick="history.go(-1)"/>
                    Convênio - Plano de Saúde
                </h1>
                <p:messages id="messages" showDetail="true" autoUpdate="true"  /> 
                <div class="container_24 clearfix">
                    <div class="grid_24"> 
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Pesquisar</h4></legend>
                            <p:panel id="userPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:outputLabel value="Nome:" styleClass="grid_3"/>
                                <p:inputText styleClass="grid_20" value="#{managerSearchOperator.searchOperator.name}"/>
                                <div class="clear"/>
                                <p:outputLabel value="ANS: " styleClass="grid_3"/>
                                <p:inputText styleClass="grid_8" value="#{managerSearchOperator.searchOperator.ans}"/>

                            </p:panel>

                        </fieldset>

                        <br/>
                        <div class="buttonAction">
                            <p:commandButton value="Pesquisar" icon="ui-icon-search"
                                             update="@form, tableCon"
                                             actionListener="#{managerSearchOperator.listOperator()}"
                                             styleClass="ui-priority-primary" />
                            <p:button href="indexoperator.xhtml" value="Cancelar"  icon="ui-icon-arrowreturnthick-1-w" />
                        </div >
                    </div>
                    <div class="clear"></div>
                    <div class="grid_24"> 
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Resultado</h4></legend>
                            <p:panel id="resultPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:dataTable id="tableCon" var="c" value="#{managerSearchOperator.operators}" 
                                             styleClass="grid_24"
                                             rowIndexVar="rowid"
                                             rowKey="#{c.id}"
                                             rows="5" paginator="true"  
                                             paginatorPosition="bottom"
                                             emptyMessage="Nenhum registro">  
                                    <f:facet name="header">
                                        Convênios
                                    </f:facet>
                                    <p:column headerText="Ação" width="75">

                                        <p:button icon="ui-icon-pencil" alt="Editar Convênio" title="Editar Convênio"
                                                  href="editoperator.xhtml?opeEdit=#{c.id}" 
                                                  style="width: 25px; position: relative;"/>
                                        <p:button icon="ui-icon-search" alt="Visualizar Convênio" title="Visualizar Convênio"
                                                  href="showoperator.xhtml?opeShow=#{c.id}" 
                                                  style="width: 25px; position: relative"/>

                                    </p:column>
                                    <p:column headerText="Nome" width="600">  
                                        <h:outputText value="#{c.name}"/>
                                    </p:column>  
                                    <p:column headerText="Ans">  
                                        <h:outputText value="#{c.ans}"/>
                                    </p:column>


                                </p:dataTable> 

                            </p:panel>

                        </fieldset>

                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
